package com.xiaoshuidi.cloud.module.contract.convert.contract;

import com.xiaoshuidi.cloud.module.contract.controller.admin.bill.vo.ownerOrder.OwnerOrderTransferExcelVO;
import com.xiaoshuidi.cloud.module.contract.controller.admin.contract.vo.ownerContract.*;
import com.xiaoshuidi.cloud.module.contract.dal.dataobject.bill.OwnerOrderTransferDO;
import com.xiaoshuidi.cloud.module.contract.dal.dataobject.bill.RentOrderDO;
import com.xiaoshuidi.cloud.module.contract.dal.dataobject.contract.ContractHouseOwnerDO;
import com.xiaoshuidi.cloud.module.contract.service.contract.dto.OwnerContractBpmDTO;
import com.xiaoshuidi.cloud.module.contract.service.contract.dto.OwnerContractInfoFillDTO;
import com.xiaoshuidi.cloud.module.contract.service.contract.dto.OwnerRentOrderBpmDTO;
import com.xiaoshuidi.cloud.module.contract.service.contract.dto.RoomStateDTO;
import com.xiaoshuidi.cloud.module.rooms.api.roomstate.vo.GetCurrentRecordRespVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 业主合同 Convert
 *
 * @author 合房租赁
 */
@Mapper
public interface ContractHouseOwnerConvert {

    ContractHouseOwnerConvert INSTANCE = Mappers.getMapper(ContractHouseOwnerConvert.class);

    ContractHouseOwnerDO convert(ContractHouseOwnerCreateReqVO bean);

    ContractHouseOwnerDO convert(ContractHouseOwnerUpdateReqVO bean);

    ContractHouseOwnerRespVO convert(ContractHouseOwnerDO bean);

    List<ContractHouseOwnerExcelVO> convertList02(List<ContractHouseOwnerPageRespVO> list);

    RoomStateDTO convertGetCurrectRecordResp2RoomState(GetCurrentRecordRespVO bean);

    List<ContractHouseOwnerPageRespVO> convertList(List<ContractHouseOwnerDO> list);

    ContractHouseOwnerDO convert(ContractHouseOwnerRespVO bean);

    OwnerContractInfoFillDTO convertRespVo2FillDto(ContractHouseOwnerRespVO bean);

    List<OwnerOrderTransferExcelVO> convert(List<OwnerOrderTransferDO> list);

    @Mapping(target = "roomName", expression = "java(vo.getApartmentName()+vo.getRoomName())")
    @Mapping(target = "status", expression = "java(vo.getStatusDesc())")
    OwnerOrderTransferExcelVO map(OwnerOrderTransferDO vo);


    OwnerContractBpmDTO convertDo2BpmDto(ContractHouseOwnerDO bean);

    @Mapping(target = "totalAmount", expression = "java(bean.getTotalAmount().subtract(bean.getPaidRentUtilities()))")
    OwnerRentOrderBpmDTO convertRentOrder2BpmDto(RentOrderDO bean);
    List<OwnerRentOrderBpmDTO> convertRentOrders2BpmDtos(List<RentOrderDO> list);
}
